package com.briup.ptp.service.impl;



import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.briup.ptp.entity.House;
import com.briup.ptp.service.HouseService;
import com.briup.ptp.mapper.HouseMapper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.List;


/**
* @author sunta
* @description 针对表【House】的数据库操作Service实现
* @createDate 2024-02-26 16:19:08
*/
@Service
public class HouseServiceImpl extends ServiceImpl<HouseMapper, House> implements HouseService{


    @Autowired
    HouseMapper mapper;

    //一、分页+条件查询栏舍信息
    @Override
    public PageInfo<House> queryHouseInfo(String name, Integer pageNum, Integer pageSize) {
        List<House> list = mapper.queryHouseInfo(name,pageNum, pageSize);
        PageInfo<House> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
    @Override
    public void saveOrUpdateHouse(House house) {
        if(house.getId()==null){
            mapper.insertHouse(house);
        }else {
            mapper.updateHouse(house);
        }
    }
    @Override
    public void deleteHouse(Integer id) {
        mapper.deleteHouse(id);
    }

    @Override
    public void batchDeleteHouse(List<Integer> id) {
        mapper.batchDeleteHouse(id);
    }
}




